package com.example.service.impl;

import com.example.controller.Code;
import com.example.dao.UserDao;
import com.example.pojo.User;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.awt.print.Book;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;
    @Override
    public User findById(Integer id) {
        User user = userDao.findById(id);
        return user;
    }

    @Override
    public boolean add(User user) {
        return userDao.add(user)>0;
    }

    @Override
    public boolean delete(Integer id) {
        Integer delete = userDao.delete(id);
        System.out.println(delete);//影响条数
        return delete>0;
    }

    @Override
    public List<User> findAll() {
        List<User> users = userDao.findAll();
        return users;
    }

    @Override
    public boolean update(User user) {
        return userDao.update(user)>0;
    }



}
